package com.jay.lang.management.intf;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;

public class ThreadMXBeanIntf {
	public static void main(String[] args) {
		ThreadMXBean mxbean = ManagementFactory.getThreadMXBean();
		System.out.println(mxbean.getCurrentThreadCpuTime());
		System.out.println(mxbean.getCurrentThreadUserTime());
		System.out.println(mxbean.getDaemonThreadCount());
		System.out.println(mxbean.getPeakThreadCount());
		System.out.println(mxbean.toString());
		System.out.println(mxbean.getClass());
		System.out.println(mxbean.getObjectName());
		System.out.println(mxbean.isCurrentThreadCpuTimeSupported());
		System.out.println(mxbean.isObjectMonitorUsageSupported());
		System.out.println(mxbean.isSynchronizerUsageSupported());
		System.out.println(mxbean.isThreadContentionMonitoringEnabled());
		System.out.println(mxbean.isThreadContentionMonitoringSupported());
		System.out.println(mxbean.isThreadCpuTimeEnabled());
		System.out.println(mxbean.isThreadCpuTimeSupported());

		System.out.println("-----------------------");

		long[] ids = mxbean.getAllThreadIds();
		for (long id : ids) {
			System.out.println(mxbean.getThreadCpuTime(id));
			System.out.println(mxbean.getThreadUserTime(id));
		}
	}
}
